﻿Imports Persistencia
Imports DSControlePadrao
Public Class ctrFrete
    Inherits ctrPadrao

#Region "Variáveis"

    Private objFrete As New perFrete

#End Region

    Public Function sqlConsulta()

        Return Me.objFrete.sqlConsulta

    End Function

    Public Function sqlConsulta(ByVal sCodFrete As String)

        Return Me.objFrete.sqlConsultaExpedicao(sCodFrete)

    End Function

    Public Function retornarDescItinerario(ByVal sCodFrete As String) As String

        Return Me.objFrete.retornarDestItinerario(sCodFrete)

    End Function

    Public Function retornarExpedicao(ByVal sCodFrete As String,
                                      ByVal iCodExpedicao As Integer) As DataTable

        Return Me.objFrete.retornarExpedicao(sCodFrete, iCodExpedicao)

    End Function

    Public Function retornarValorFrete(ByVal dPeso As Double, ByVal dPrecoFrete As Decimal) As Decimal

        Try
            Return dPeso * dPrecoFrete

        Catch ex As Exception

            Throw New Exception("Ocorreu um erro ao calcular o valor do frete. " & _
                                    Environment.NewLine & ex.Message)


        End Try

    End Function

End Class
